<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">BAYESERR</b>
<td valign="baseline" align="right" class="function"><a href="../bayes/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>Bayesian risk for 1D Gaussians and 0/1-loss.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;[risk,eps1,eps2,inter1]&nbsp;=&nbsp;bayeserr(model)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;This&nbsp;function&nbsp;computes&nbsp;Bayesian&nbsp;risk&nbsp;of&nbsp;a&nbsp;classifier&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;with&nbsp;the&nbsp;following&nbsp;assumptions:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;-&nbsp;1/0&nbsp;loss&nbsp;function&nbsp;(risk&nbsp;=&nbsp;expectation&nbsp;of&nbsp;misclassification).</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;-&nbsp;Binary&nbsp;classification.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;-&nbsp;Class&nbsp;conditional&nbsp;probabilities&nbsp;are&nbsp;univariate&nbsp;Gaussians.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;[struct]&nbsp;Mixture&nbsp;of&nbsp;two&nbsp;univariate&nbsp;Gaussians.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Mean&nbsp;[1x2]&nbsp;Mean&nbsp;values&nbsp;[Mean1&nbsp;Mean2].</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Cov&nbsp;[1x2]&nbsp;Covariances&nbsp;[Cov1&nbsp;Cov2].</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Prior&nbsp;[1x2]&nbsp;A&nbsp;priory&nbsp;probabilities.</span><br>
<span class=help>&nbsp;</span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;risk&nbsp;[1x1]&nbsp;Bayesian&nbsp;risk&nbsp;for&nbsp;an&nbsp;optimal&nbsp;classifier.</span><br>
<span class=help>&nbsp;&nbsp;eps1&nbsp;[1x1]&nbsp;Integral&nbsp;of&nbsp;p(x|k=1)&nbsp;over&nbsp;x&nbsp;in&nbsp;L2,&nbsp;where</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;L2&nbsp;is&nbsp;the&nbsp;area&nbsp;where&nbsp;x&nbsp;is&nbsp;classified&nbsp;to&nbsp;the&nbsp;2nd&nbsp;class.</span><br>
<span class=help>&nbsp;&nbsp;eps2&nbsp;[1x1]&nbsp;Integral&nbsp;of&nbsp;p(x|k=2)&nbsp;over&nbsp;x&nbsp;in&nbsp;L1,&nbsp;where</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;L1&nbsp;is&nbsp;the&nbsp;area&nbsp;where&nbsp;x&nbsp;is&nbsp;classified&nbsp;to&nbsp;the&nbsp;1st&nbsp;class.</span><br>
<span class=help>&nbsp;&nbsp;inter1&nbsp;[1x2]&nbsp;or&nbsp;[1x4]&nbsp;One&nbsp;or&nbsp;two&nbsp;intervals&nbsp;describing&nbsp;L1.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;=&nbsp;struct('Mean',[0&nbsp;0],'Cov',[1&nbsp;0.4],'Prior',[0.4&nbsp;0.6]);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;hold&nbsp;on;&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;h&nbsp;=&nbsp;pgmm(model,struct('comp_color',['r'&nbsp;'g']));&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;legend(h,'P(x)','P(x|y=1)*P(y=1)','P(x|y=2)*P(y=2)');</span><br>
<span class=help>&nbsp;&nbsp;[risk,eps1,eps2,interval]&nbsp;=&nbsp;bayeserr(model)</span><br>
<span class=help>&nbsp;&nbsp;a&nbsp;=&nbsp;axis;</span><br>
<span class=help>&nbsp;&nbsp;plot([interval(2)&nbsp;interval(2)],[a(3)&nbsp;a(4)],'k');</span><br>
<span class=help>&nbsp;&nbsp;plot([interval(3)&nbsp;interval(3)],[a(3)&nbsp;a(4)],'k');</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=also_field>See also </span><span class=also></span><br>
<span class=help><span class=also>&nbsp;&nbsp;<a href = "../bayes/bayesdf.html" target="mdsbody">BAYESDF</a>,&nbsp;<a href = "../bayes/bayescls.html" target="mdsbody">BAYESCLS</a></span><br>
<span class=help><span class=also></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../bayes/list/bayeserr.html">bayeserr.m</a>
  <p><b class="info_field">About: </b>  Statistical Pattern Recognition Toolbox<br>
 (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a><br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a><br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 22-oct-2009, VF, fixed bug on line 157; bug reported 2009-10-08 by krejci.filip@gmail.com<br>
 20-mar-2006, VF, A mistake in help removed; bug reported by O. Sychrovksy.<br>
 02-may-2004, VF<br>
 19-sep-2003, VF<br>
 27-Oct-2001, VF<br>

</body>
</html>
